<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    let ws = new WebSocket('ws://192.168.5.178:3000');
    ws.onopen = function (params) {
      console.log('客户端连接成功')
      // 向服务器发送消息
      let data ={
          cmd:101,
          msg:"haha"
      }
      ws.send(JSON.stringify(data))
    };

    ws.onmessage = function (e) {
      console.log('收到服务器响应', e.data)
    };

    </script>
</body>
</html>